﻿using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Project;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.Win32;
using System.Collections.Generic;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution;


namespace Izhgtu.SandcastlePackage.DocumentReferenceItem
{
    /// <summary>
    /// This type of node is used for references to COM components.
    /// </summary>
    [CLSCompliant(false)]
    [ComVisible(true)]
    class DocumentReferenceNode : ReferenceNode
    {

        private string documentPath = @"C:\Documents and Settings\Роман\Мои документы\Visual Studio 2008\Projects\tetsSandCatle\tetsSandCatle\bin\Debug\tetsSandCatle.XML";
        private string documentName = "tetsSandCatle";


        public DocumentReferenceNode(ProjectNode root) 
            : base(root)
        {
            this.VirtualNodeName = documentName;
            BindReferenceData();
        }

        protected override void BindReferenceData()
        {
            ///Debug.Assert(this.documentName != null, "The AssemblyName field has not been initialized");

            // If the item has not been set correctly like in case of a new reference added it now.
            // The constructor for the AssemblyReference node will create a default project item. In that case the Item is null.
            // We need to specify here the correct project element. 
           /// if (!(this.ItemNode == null || this.ItemNode.Item == null))
           // {
               this.ItemNode = new ProjectElement(this.ProjectMgr, documentPath, ProjectFileConstants.DocumentationReference);
            //}

            // Set the basic information we know about
            this.ItemNode.SetMetadata(ProjectFileConstants.Name, documentName);
            if (!string.IsNullOrEmpty(documentPath))
            {
                this.ItemNode.SetMetadata(ProjectFileConstants.AssemblyName, Path.GetFileName(documentPath));
            }
            else
            {
                this.ItemNode.SetMetadata(ProjectFileConstants.AssemblyName, null);
            }

            //this.SetReferenceProperties();
   
        }


    }
}
